package com.cloudbroker.bcs.platform.dav.bizapi.constants.status;

/**
 * Created by lnq on 2016/8/22.
 */
public enum AccessTokenType {

    OPENAPI_TOKEN(0, "openapi的token"),
    ITN_TOKEN(1, "itn的token")
    ;

    private final Integer val;
    private final String description;
    private String toString;

    AccessTokenType(Integer val, String description) {
        this.val = val;
        this.description = description;
    }

    public Integer getVal() {
        return val;
    }

    public static String getDescription(int realVal) {
        for (ClientStatus s : ClientStatus.values()) {
            if (s.getVal() == realVal) {
                return s.getDescription();
            }
        }
        return String.valueOf(realVal);
    }

    @Override
    public String toString() {
        if (null == toString) {
            toString = new StringBuilder().append("AccessTokenType[").append(val).append(':').append(description)
                    .append(']').toString();
        }
        return toString;
    }
}
